#region Using directives

/*
 * Copyright (c) 2007 Alan Dean.
 * All rights released.
 */

using System;
using System.Diagnostics.CodeAnalysis;
using System.Security.Permissions;

using Edenbrook;

#endregion

namespace Edenbrook.Telephony
{
    #region Overview
    /// <summary>
    /// Represents a standard keypad.
    /// <para>This class cannot be inherited.</para>
    /// </summary>
    /// 
    /// <remarks>
    /// The layout for this keypad is:
    /// <list type="bullet">
    ///   <item><term>Key 1</term><description></description></item>
    ///   <item><term>Key 2</term><description>A B C</description></item>
    ///   <item><term>Key 3</term><description>D E F</description></item>
    ///   <item><term>Key 4</term><description>G H I</description></item>
    ///   <item><term>Key 5</term><description>J K L</description></item>
    ///   <item><term>Key 6</term><description>M N O</description></item>
    ///   <item><term>Key 7</term><description>P Q R S</description></item>
    ///   <item><term>Key 8</term><description>T U V</description></item>
    ///   <item><term>Key 9</term><description>W X Y Z</description></item>
    ///   <item><term>Key 0</term><description>_</description></item>
    /// </list>
    /// </remarks>
    /// 
    /// <permission cref="T:System.Security.Permissions.StrongNameIdentityPermission">
    /// Callers must be signed with the Edenbrook strong name key.
    /// </permission>
    #endregion
    [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
    [StrongNameIdentityPermission(SecurityAction.Demand, PublicKey = PublicKey.Value)]
    public sealed class StandardKeypad : KeypadBase
    {
        // public constructors

        #region public StandardKeypad()
        /// <overloads>
        /// Initializes a new instance of the <see cref="T:Edenbrook.Telephony.StandardKeypad"/> class.
        /// </overloads>
        /// 
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Edenbrook.Telephony.StandardKeypad"/> class.
        /// </summary>
        /// 
        /// <remarks>None</remarks>
        public StandardKeypad()
            : this(2, 10)
        { }
        #endregion

        #region public StandardKeypad(int, int)
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Edenbrook.Telephony.StandardKeypad"/> class
        /// with the specified <paramref name="typingTime"/> and <paramref name="waitingTime"/>.
        /// </summary>
        /// 
        /// <param name="typingTime">The time taken to type a single character.</param>
        /// <param name="waitingTime">The time taken to wait for a character to 'fix'.</param>
        /// 
        /// <remarks>None</remarks>
        public StandardKeypad(int typingTime, int waitingTime)
            : base(typingTime, waitingTime)
        {
            this[' '] = new CharacterLocation(0, 0);

            this['A'] = new CharacterLocation(2, 0);
            this['B'] = new CharacterLocation(2, 1);
            this['C'] = new CharacterLocation(2, 2);

            this['D'] = new CharacterLocation(3, 0);
            this['E'] = new CharacterLocation(3, 1);
            this['F'] = new CharacterLocation(3, 2);

            this['G'] = new CharacterLocation(4, 0);
            this['H'] = new CharacterLocation(4, 1);
            this['I'] = new CharacterLocation(4, 2);

            this['J'] = new CharacterLocation(5, 0);
            this['K'] = new CharacterLocation(5, 1);
            this['L'] = new CharacterLocation(5, 2);

            this['M'] = new CharacterLocation(6, 0);
            this['N'] = new CharacterLocation(6, 1);
            this['O'] = new CharacterLocation(6, 2);

            this['P'] = new CharacterLocation(7, 0);
            this['Q'] = new CharacterLocation(7, 1);
            this['R'] = new CharacterLocation(7, 2);
            this['S'] = new CharacterLocation(7, 3);

            this['T'] = new CharacterLocation(8, 0);
            this['U'] = new CharacterLocation(8, 1);
            this['V'] = new CharacterLocation(8, 2);

            this['W'] = new CharacterLocation(9, 0);
            this['X'] = new CharacterLocation(9, 1);
            this['Y'] = new CharacterLocation(9, 2);
            this['Z'] = new CharacterLocation(9, 3);
        }
        #endregion
    }
}